home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / MATHS / ARCAUT / Automatons / Hodge < prev    next >
Text File  |  1991-07-27  |  915b  |  37 lines

  1. AUTOMATON*
  2.  
  3.   Hodge_Podge
  4.  
  5.   An interesting 256 state Moore neighbourhood automaton, originally
  6.   described in 'Scientific American'. Compare the behaviour with the much
  7.   simpler 'Rug'. This is a slow automaton, as it requires a division
  8.   calculation to be performed for each cell, so try a window of size 50x50.
  9.  
  10. INITIALISATION*
  11.  
  12.   10DEF PROCdo
  13.   20*SetEval wrap on
  14.   30*SetEval sick 255
  15.   40*SetEval g 3
  16.   50*SetEval k1 2
  17.   60*SetEval k2 1
  18.   70ENDPROC
  19.  
  20. SCREEN*
  21.  
  22.   10DEF PROCdo
  23.   20DIM buf% 256:SYS "OS_ReadVarVal","sick",buf%,256:sick=!buf%
  24.   30PROCsoup(0,sick+1,1)
  25.   40ENDPROC
  26.  
  27. CODE*
  28.  
  29. ( READ_NEIG
  30.   CELL <sick> = IF (dead ==)
  31.   CELL  dead  = IF (dead SCOUNT_ALL DUP <k2>
  32.                     DIV TRASH SWAP <sick> SCOUNT_ALL
  33.                     + 9 SWAP - <k2> DIV TRASH + ==        )
  34.               ELSE (SUM_ALL [dead+1] [<sick>-1] MCOUNT_ALL
  35.                     DIV TRASH <g> + ==                    ) )
  36.  
  37. END*